<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>{$webtitle}_注册会员</title>
        <link href="{$Think.const.TEMPLATE_PATH}/css/Register.css" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
    </head>
    <body>
        <header>
            <div class="w12 header">
                <a class="db logo fl"><img src="{$Think.const.TEMPLATE_PATH}/img/register/logo.png" width="327" height="94"  alt=""/></a>
                <div class="fr logofr"><a href="__MODULE__/index/index"  target="_blank" class="blk">返回首页</a> |<a href="#" target="_blank" class="blk">客服中心</a><br>
                    如注册遇到问题请拨打：<strong style="font-size:14px;">400-098-9162</strong></div>
            </div>
        </header>
        <div class="head_border"></div>
        <section class="w12 login">
            <em class="fr">已经是会员，请&nbsp;&nbsp;<a  href="__MODULE__/Index/index" target="_blank" class="db logbtn fr">前往登录</a> </em>
        </section>
        <section class="main w12">
            <div class="fr tit2"><span class="arr"></span></div>
            <div class="inputsec">
                <ul><!--readonly  -->
                    <form name='myform' method="post" action="__CONTROLLER__/index" onsubmit='return check();'>
                        <li><label class="fl mr2">商务中心编号：</label><input type="text" name="zmd_number"  value="{$uname}" class="txt-m fl "><font class="co">* 必填</font><span style="margin-left:20px;color:blue;" id="sb1"></span></li>
                        <li><label class="fl mr2">推荐人编号：</label><input style='background:#ddd;' type="text" name="tjr_accname" value="{$uname}" class="txt-m fl "><font class="co">* 必填</font><span style="margin-left:20px;color:blue;" id="sb2"></span></li>
                        <li><label class="fl mr2">接点人编号：</label><input type="text" name="jdr_number"  value="{$jdr}" class="txt-m fl "><font class="co">* 必填</font><span style="margin-left:20px;color:blue;" id="sb3"></span></li>
                        <li><label class="fl mr2">市场位置：</label>
                            <span id="left"><input type="radio" name="s" value="1" <eq name='sb' value='1'>checked</eq> id='left1' />左区</span>
                            <span id="right"><input type="radio" name="s" value="2" <eq name='sb' value='2'>checked</eq> id='right1' />右区</span><font style="color:red;margin-left:20px;">( 左右区都可以选择)</font>
                            <input type="hidden" name='mark' id='mark' value=''>
                        </li>
                        <li><label class="fl mr2">报单级别：</label>
                            <select class="txt-m fl" name="grade_id" id='sb4'>
                                <option value="">--请选择--</option>
                                <foreach name="grade" item="v">
                                    <option value="{$v.id}">{$v.grade_name} 报单金额：{$v.grade_feemoney}</option>
                                </foreach>
                            </select>
                            <font class="co">* 必填</font>
                        </li>
                        <li><label class="fl mr2">会员编号：</label><input type="text" name="account" value="<if condition='$automatic eq 1'> {$account} </if>" class="txt-m fl" /><a href="javascript:location.reload()">换一个</a><font id='pd1' style='color:red;'></font></li>
                        <li><label class="fl mr2">登录密码：</label><input type="password" name="pwd"  value="{$pass}" class="txt-m fl "><font class="co">* 黙认为：{$pass}</font></li>
                        <li><label class="fl mr2">支付密码：</label><input type="password"  name="secpwd" value="{$rpass}" class="txt-m fl "><font class="co">* 黙认为：{$rpass}</font></li>
                        <if condition="$regphonestate eq 1"><li><label class="fl mr2">手机号码：</label><input type="text" name="phone" class="txt-m fl "><font class="co">*</font></li></if>
                        <if condition="$regemailstate eq 1"><li><label class="fl mr2">邮箱号码：</label><input type="text" name="email" class="txt-m fl "><font class="co">*</font></li></if>
                        <if condition="$regqqstate eq 1"><li><label class="fl mr2">QQ 号码：</label><input type="text" name="qq" class="txt-m fl "><font class="co">*</font></li></if>
                        <if condition="$regweixinstate eq 1"><li><label class="fl mr2">微信账号：</label><input type="text" name="weixin" class="txt-m fl "><font class="co">*</font></li></if>
                        <if condition="$regcardstate eq 1"><li><label class="fl mr2">身份证号：</label><input type="text" name="card" class="txt-m fl "><font class="co">*</font></li></if>
                        <if condition="$reglandlinestate eq 1"><li><label class="fl mr2">固定电话：</label><input type="text" name="landline" class="txt-m fl "><font class="co">*</font></li></if>
						<li><label class="fl mr2">姓名:</label><input type="text" name="username" class="txt-m fl "><font class="co">*</font></li>
                        <li><label class="fl mr2">性别：</label>
                            <input type="radio" name="sex" value="0" checked />保密
                            <input type="radio" name="sex" value="1" />男
                            <input type="radio" name="sex" value="2" />女 
                        </li> 
    <!--                     <li><label class="fl mr2">验证码：</label><span class="fl yzm"><input type="text" class="fl txt-y" id="identify" name="code"  />
                                <a class="fl mr2 mt2"><img src="__CONTROLLER__/Verifyimg" width="83" height="27" onclick="this.src = '__CONTROLLER__/Verifyimg?id=' + Math.random();";/></a><a class="fl chg" onclick='this.previousSibling.lastChild.src = "__CONTROLLER__/Verifyimg?id=" + Math.random();'>换一张</a><font id="cy"></font></span></li>
                                               <li><label class="fl mr2">校验码：</label><span class="fl yzm2"><input type="text" class="fl txt-j" id="identify" name="identify" />
                                                    </span>
                                                    <a class="db fl chg send">发送至手机</a>
                                                </li>-->
                        <li><label class="fl">&nbsp;</label><p style=" line-height: 28px; "><input type="checkbox" name="checkbox1" value="1" checked>我已阅读并同意<a style="text-decoration:underline;">《众福网络会员注册服务条款协议》</a></p></li>
                        <li class="clr"><label class="db fl">&nbsp;</label><input class="db fl next" type="submit" id="btn"  value="注册" /></li>
                        <div style="display:none;" id="yz"></div>
                    </form>
                </ul>
            </div>
        </section>
    </body>
</html>
<script type="text/javascript">

    $(function () {
        var account = $('input[name="account"]').val();
        $.get('__CONTROLLER__/yz', {accname: account}, function (data) {
            if (data == 1)
            {
                $('#pd1').html('该帐号已存在');
            } else {
                $('#pd1').html('');
            }
        });

        $('input[name="account"]').blur(function () {
            var accname = $(this).val();
            if (accname == '')
            {
                $('#pd1').html('请填写帐号');
            } else {
                $.get('__CONTROLLER__/yz', {accname: accname}, function (data) {
                    if (data == 1)
                    {
                        $('#pd1').html('该帐号已存在');
                    } else {
                        $('#pd1').html('');
                    }
                });
            }
        });
    });

    //验证码ajax请求验证
    $('#identify').keyup(function () {
        var yzm = $(this).val();
        $.get('__CONTROLLER__/cyzm', {code: yzm}, function (data) {
            if (data == 1)
            {
                $('#cy').html('√');
                $('#btn').prop('type', 'submit');
                $('#btn').css({'background': '#1ca521', 'color': '#fff'});
            } else {
                $('#cy').html('');
                $('#btn').prop('type', 'button');
                $('#btn').css({'background': '#ddd', 'color': 'red'});
            }
        });

    });

    //推荐人编号验证
    var tjr_number = $('input[name="tjr_accname"]').val();

    $.get('__CONTROLLER__/ck', {tjr: tjr_number}, function (data) {
        if (data == 0) {
            $('#sb2').html('此推荐人编号不存在,请重新输入！');
        } else if (data == 1) {
            $('#sb2').html('');
            $('#right').css('visibility', 'hidden');
            $('#left1').prop('checked', true);
            $('#right1').prop('checked', false);
            $('#mark').val('1');
        } else if (data == 2) {
            $('#sb2').html('');
        }
    });


    //报单编号验证是否为激活状态
    $('input[name="zmd_number"]').blur(function () {
        var zmd_number = $(this).val();
        $.get('__CONTROLLER__/ck', {zmd: zmd_number}, function (data) {
            if (data == 0) {
                $('#sb1').html('此报单编号不存在,请重新输入！');
            } else if (data == 1) {
                $('#sb1').html('此报单编号未激活,请激活或重新输入！');
            } else if (data == 2) {
                $('#sb1').html('此报单编号非报单中心,请申请通过后重新输入！');
            } else if (data == 3) {
                $('#sb1').html('此报单编号审核中,请审核通过通过后重新输入！');
            } else {
                $('#sb1').html('');
            }
        });

    });

    var zmd_number = $('input[name="zmd_number"]').val();
    $.get('__CONTROLLER__/ck', {zmd: zmd_number}, function (data) {
        if (data == 0) {
            $('#sb1').html('此报单编号不存在,请重新输入！');
        } else if (data == 1) {
            $('#sb1').html('此报单编号未激活,请激活或重新输入！');
        } else if (data == 2) {
            $('#sb1').html('此报单编号非报单中心,请申请通过后重新输入！');
        } else if (data == 3) {
            $('#sb1').html('此报单编号审核中,请审核通过通过后重新输入！');
        } else {
            $('#sb1').html('');
        }
    });

    //接点人编号验证
    $('input[name="jdr_number"]').blur(function () {
        var jdr_number = $(this).val();

        $.get('__CONTROLLER__/ck', {jdr: jdr_number}, function (data) {
            if (data == 0) {
                $('#sb3').html('此接点人编号不存在,请重新输入！');
            } else if (data == 1) {
                $('#right').css('visibility', 'hidden');
                $('#left').css('visibility', 'visible');
                $('#left1').prop('checked', true);
                $('#right1').prop('checked', false);
                $('#sb3').html('');
            } else if (data == 2) {
                if ($('#mark').val() == '1') {
                    $('#sb3').html('推荐人第一单必须放左区，接点人左区已满，请重新输入！');
                } else {
                    $('#right').css('visibility', 'visible');
                    $('#right1').prop('checked', true);
                    $('#left1').prop('checked', false);
                    $('#left').css('visibility', 'hidden');
                    $('#sb3').html('');
                }
            } else if (data == 3) {
                $('#sb3').html('此接点人左右区已满，请重新输入！');
            }
        });

    });

    var jdr_number = $('input[name="jdr_number"]').val();

    $.get('__CONTROLLER__/ck', {jdr: jdr_number}, function (data) {
        if (data == 0) {
            $('#sb3').html('此接点人编号不存在,请重新输入！');
        } else if (data == 1) {
            $('#right').css('visibility', 'hidden');
            $('#left1').prop('checked', true);
            $('#right1').prop('checked', false);
            $('#sb3').html('');
        } else if (data == 2) {
            if ($('#mark').val() == '1') {
                $('#sb3').html('推荐人第一单必须放左区，接点人左区已满，请重新输入！');
            } else {
                $('#right').css('visibility', 'visible');
                $('#right1').prop('checked', true);
                $('#left1').prop('checked', false);
                $('#left').css('visibility', 'hidden');
                $('#sb3').html('');
            }
        } else if (data == 3) {
            $('#sb3').html('此接点人左右区已满，请重新输入！');
        }
    });

    function check()
    {
        var zmd = $('input[name="zmd_number"]').val();
        var jdr = $('input[name="jdr_number"]').val();
        var account = $('input[name="account"]').val();
        var accname = $('input[name="tjr_accname"]').val();
        var secpwd = $('input[name="secpwd"]').val();
        var phone = $('input[name="phone"]').val();
        var email = $('input[name="email"]').val();
        var qq = $('input[name="qq"]').val();
        var weixin = $('input[name="weixin"]').val();
        var card = $('input[name="card"]').val();
        var username = $('input[name="username"]').val();
        var landline = $('input[name="landline"]').val();
        var pd1 = $('#pd1').html();
        var pass = $('input[name="pwd"]').val();
        var checkbox1 = $('input[name="checkbox1"]').attr('checked');
        var yzm = $('#identify').val();

        if (zmd == "") {
            alert('请输入报单编号');
            return false;
        }
        if (jdr == "") {
            alert('请输入接点人编号');
            return false;
        }
        if (account == '')
        {
            alert('请输入帐号');
            return false;
        }
        if ($('#sb4').val() == "") {
            alert('请选择报单级别');
            return false;
        }
        if (checkbox1 == undefined)
        {
            alert('同意注册协议后在试');
            return false;
        }
        if (card == '')
        {
            alert('身份证号不能为空');
            return false;
        }
		if (username == '')
        {
            alert('姓名');
            return false;
        }
        if (landline == '')
        {
            alert('固定电话不能为空');
            return false;
        }
        if (weixin == '')
        {
            alert('微信号码不能为空');
            return false;
        }
        if (qq == '')
        {
            alert('QQ 号码不能为空');
            return false;
        }
        if (email == '')
        {
            alert('邮箱号码不能为空');
            return false;
        }
        if (phone == '')
        {
            alert('手机号码不能为空');
            return false;
        }
        if (accname == '')
        {
            alert('请输入推荐人帐号');
            return false;
        }
        if (pass == '')
        {
            alert('请输入密码');
            return false;
        } else {
            if (pass.match(/^[a-zA-Z0-9\_\@\#\$\%\^\&]{6,16}$/)) {
            } else {
                alert('密码格式不正确');
                return false;
            }
        }
        if (secpwd == '')
        {
            alert('请输入二级密码');
            return false;
        } else {
            if (pass.match(/^[a-zA-Z0-9\_\@\#\$\%\^\&]{6,16}$/)) {
            } else {
                alert('二级密码格式不正确');
                return false;
            }
        }
        if (accname != 'a88888888')
        {
            if (pd1 == '')
            {
            } else {
                return false;
            }
        }

        if ($('#sb1').html() == '' && $('#sb2').html() == '' && $('#sb3').html() == '') {

        } else {
            return false;
        }
        return true;
    }
</script>
